package cmo.lby.rabbitmq;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import cmo.lby.common.Constant;

@Component
public class Receiver {

	private static final Logger logger = LoggerFactory.getLogger("Receiver1");
	
	@RabbitHandler
	@RabbitListener(queues = Constant.QUEUE_NAME)
	public void process(String str) {
		System.out.println("Receiver1 : " + str);
		logger.info("Receiver:{}", str);
	}
	
	@RabbitListener(queues=Constant.QUEUE_TOPIC)    //监听器监听指定的Queue
    public void process1(String str) {    
        System.out.println("message:"+str);
    }

	@RabbitListener(queues=Constant.QUEUE_TOPIC_S)    //监听器监听指定的Queue
    public void process2(String str) {
        System.out.println("message_s:"+str);
    }
	
	@RabbitListener(queues=Constant.QUEUE_MSG_SMS_SEND)    //监听器监听指定的Queue 延迟队列
    public void processDelay(String str) {
        System.out.println("delay message:"+str + ", now:" + System.currentTimeMillis());
    }
	
}
